package org.yinweichen.llm_dataset_backend.entity;

import jakarta.persistence.*;
import lombok.*;
import org.springframework.data.annotation.LastModifiedDate;
import java.util.Date;

@Data
@Entity
@Table(name = "original_questions")
@NoArgsConstructor
@AllArgsConstructor
@Builder
@IdClass(OriginalQuestionId.class)
public class OriginalQuestion {
    @Id
    private Long id;

    @Id
    private String version;

    @Column(name = "title", nullable = false, columnDefinition = "TEXT(200)", length = 200)
    private String title;

    @Column(name = "update_time")
    @LastModifiedDate
    private Date updateTime;

    @Column(name = "content", columnDefinition = "TEXT(65535)")
    private String content;

    @Column(name = "source", length = 255)
    private String source;

    @Column(name = "active", nullable = false, columnDefinition = "BOOLEAN DEFAULT true")
    private Boolean active = true;

    // 单向关联，通过Repository查询关联的StandardQuestions
    //TODO: 在数据更新时考虑Transaction
}
